<?php
$this->breadcrumbs()->addPage("Busca", '#!', 'busca', 'index');
$this->breadcrumbs()->addPage('Resultados');
echo $this->breadcrumbs()->render();

?>

<table class="grid">
    <thead>
        <tr>
            <th style="width: 6%">Número</th>
            <th>Nome</th>
            <th>Criando em</th>
            <th>Detalhes</th>
        </tr>
    </thead>
    <tbody>
        <?php $total = 0; foreach ($this->documents as $key => $document) :  $total++;?>
            <tr class="<?php echo ($key % 2) ? 'even' : 'odd' ?>">
                <td style="text-align: center"><?php echo $key + 1; ?></td>
                <td><?php echo $document->title; ?></td>
                <td><?php echo $document->updated->format('d-m-Y H:i:s'); ?></td>
                <td><a href="/folder/id/<?php echo $document->parentId; ?>/document/<?php echo $document->id; ?>" ajax="✓">Ir para pasta</a></td>
            </tr>
        <?php endforeach; ?>
        <tr>
            <?php if (!isset($key)) :?>
            <td colspan="8">Nenhum arquivo encontrado.</td>
            <?php endif; ?>
        </tr>
    </tbody>
    <?php
    $html = '<div class="mark_all">Total de itens: <strong>' . $total . '</strong></div>';
    echo $this->pagenav()->openList();
    echo $this->pagenav()->customHelperLinks($html);
    echo $this->pagenav()->closeList();
    ?>
</table>
<script type="text/javascript">
    $(function(){
        $("#dialog").dialog( "close" );
        $("ul.pastas ul li").each(function(){
            if ($(this).attr('class') == "directory expanded")
                $(this).find('a').triggerHandler('click');
        });
    });
</script>